package com.tjoris.bpmstudio;

import com.tjoris.midigateway.IMidiAction;

public class BpmMultipleOnOffAction extends AbstractBpmOnOffAction
{
	private final IMidiAction[] fOnActions;
	private final IMidiAction[] fOffActions;
	
	public BpmMultipleOnOffAction(final String id, final String name, IMidiAction[] onActions, IMidiAction[] offActions)
	{
		super(id, name);
		fOnActions = onActions;
		fOffActions = offActions;
	}
	
	public boolean isVariable()
	{
	    return false;
	}
	
	public void performAction(final boolean on, final int value)
	{
		final IMidiAction[] actions = on ? fOnActions : fOffActions;
		for (int i = 0; i < actions.length; ++i)
		{
			actions[i].performAction(true, 0);
		}
	}
}
